﻿<UserControl x:Class="EasyInvoice.WPF.Pages.CreateInvoices"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:EasyInvoice.WPF.ViewModel"
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:app="clr-namespace:EasyInvoice.WPF">
    <Grid Style="{StaticResource ContentRoot}">
        <Grid.DataContext>
            <vm:CreateInvoiceViewModel/>
        </Grid.DataContext>
        <StackPanel Orientation="Vertical">
            <StackPanel.Resources>
                <Style TargetType="StackPanel">
                    <Setter Property="Orientation" Value="Horizontal" />
                    <Setter Property="Margin" Value="0,0,0,4" />
                </Style>
                <Style TargetType="TextBlock">
                    <Setter Property="Width" Value="120" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                </Style>
            </StackPanel.Resources>

            <TextBlock Text="Create Bulk Invoices" Style="{StaticResource Heading1}" Margin="0,0,0,8" />
            <StackPanel Orientation="Horizontal">
            <TextBlock Text="Start date:"/>
            <DatePicker Text="{Binding StartDate, Mode=TwoWay}" Width="350"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
            <TextBlock Text="End date:" />
            <DatePicker Text="{Binding EndDate, Mode=TwoWay}" Width="350"/>
        </StackPanel>
            <StackPanel>
                <TextBlock Text="Client"/>
                <ComboBox Width="350" 
							  ItemsSource="{Binding Source={StaticResource clientsComboDataSource}}" 
							  SelectedItem="{Binding Client,Mode=TwoWay}" DisplayMemberPath="Name" />
            </StackPanel>
            <StackPanel Margin="0,0,0,32">
                <TextBlock Text="Seller"/>
                <ComboBox Width="350" 
							  ItemsSource="{Binding Source={StaticResource sellersComboDataSource}}" 
							  SelectedItem="{Binding Seller,Mode=TwoWay}" 
							  DisplayMemberPath="Name" 
							 />
            </StackPanel>
            <TextBlock Text="Details" Style="{StaticResource Heading2}" Margin="0,0,0,8" />

            <DockPanel>
                <DataGrid AutoGenerateColumns="False" 
							  ItemsSource="{Binding Details}" 
							  DockPanel.Dock="Top" >
                    <DataGrid.Columns>
                        <mui:DataGridTextColumn Header="Description" Binding="{Binding Description,Mode=TwoWay}"/>
                        <mui:DataGridTextColumn Header="Unit Price" Binding="{Binding Price, Mode=TwoWay}" />
                        <mui:DataGridTextColumn Header="Quantity" Binding="{Binding Units,Mode=TwoWay}"/>
                        <mui:DataGridTextColumn Header="Amount" Binding="{Binding Value}" IsReadOnly="True"/>
                    </DataGrid.Columns>
                </DataGrid>
            </DockPanel>
            <Button Content="start" HorizontalAlignment="Right"  Margin="0,32,0,8" Width="140" Command="{Binding StartCommand}"/>
        </StackPanel>
    </Grid>
</UserControl>
